package com.example.examsystem.dto;

import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 试题DTO
 */
@Data
public class QuestionDto {
    
    private Long id;
    
    @NotBlank(message = "试题标题不能为空")
    private String title;
    
    private String content;
    
    @NotBlank(message = "试题类型不能为空")
    private String type;

    private String typeName;

    @NotNull(message = "难度等级不能为空")
    @Min(value = 1, message = "难度等级最小为1")
    @Max(value = 5, message = "难度等级最大为5")
    private Integer difficulty;
    
    @NotNull(message = "分值不能为空")
    @Min(value = 1, message = "分值最小为1")
    private Double score;
    
    @NotNull(message = "学科ID不能为空")
    private Long subjectId;
    
    private Long categoryId;
    
    private List<QuestionOptionDto> options;
    
    private String answer;
    
    private String explanation;
    
    private Long createdBy;
    
    private LocalDateTime createdAt;
    
    private LocalDateTime updatedAt;
    
    // 关联信息
    private String subjectName;
    private String categoryName;
    
    /**
     * 试题选项DTO
     */
    @Data
    public static class QuestionOptionDto {
        private String content;
        private boolean correct;
    }
}


